﻿@Html.Partial("nav_bar_contenidos")
@using System.Collections
@model SIFIET.GestionContenidos.Datos.Modelo.ATRIBUTO

@{
    ViewBag.Title = "Registrar Atributo";
}

<h2>Registrar Atributo</h2>

<fieldset>
    <legend>Categoria</legend>

    <div class="display-label">
        <label>Nombre: </label>
    </div>
    <div class="display-field">
        <label>@ViewBag.categoria.NOMBRECATEGORIA</label>
    </div>
    <div class="display-label">
        <label>Descripcion:</label>
    </div>
    <div class="display-field">
        <label>@ViewBag.categoria.DESCRIPCIONCATEGORIA</label>
    </div>
    <div class="display-label">
        <label>
            Visible:
        </label>
    </div>
    <div class="display-field">
        @if (@ViewBag.categoria.VISIBLEPRINCIPALCATEGORIA == 1)
        {
            <div class="display-field">Si</div>
        }
        else
        {
            <div class="display-field">No</div>
        }
    </div>
    @using (Html.BeginForm("RegistrarAtributo", "Categorias", FormMethod.Post))
    {
        @Html.AntiForgeryToken()
        Html.EnableClientValidation();
        @Html.ValidationSummary(true)
        <fieldset>
            <legend>Registrar Atributo</legend>
            <input type="hidden" name="IDENTIFICADORCATEGORIA" value="@ViewBag.categoria.IDENTIFICADORCATEGORIA"/>
            <div class="editor-label">
                @Html.LabelFor(model => model.NOMBREATRIBUTO)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.NOMBREATRIBUTO)
                @Html.ValidationMessageFor(model => model.NOMBREATRIBUTO)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.TAMANIOATRIBUTO)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.TAMANIOATRIBUTO)
                @Html.ValidationMessageFor(model => model.TAMANIOATRIBUTO)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.TIPOATRIBUTO)
            </div>
            <div>
                @Html.DropDownListFor(model => Model.TIPOATRIBUTO, ViewBag.tipoAtributo as SelectList)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.PANELEDICIONATRIBUTO)
            </div>
            <div class="editor-field">
                Si @Html.RadioButton("PANELEDICIONATRIBUTO", "1",true)
                No @Html.RadioButton("PANELEDICIONATRIBUTO","0")
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.OBLIGATORIOATRIBUTO)
            </div>
            <div class="editor-field">
                Si @Html.RadioButton("OBLIGATORIOATRIBUTO","1", true)
                No @Html.RadioButton("OBLIGATORIOATRIBUTO", "0")
            </div>
            <div>
                <div>
                    <input type="submit" value="Agregar Atributo" onclick="" />
                </div>
            </div>
        </fieldset>
    }
</fieldset>
<div>
    @if (ViewBag.listaAtributos != null)
    {
        <table>
            <thead>
                <tr>
                    <td>Nombre</td>
                    <td>Tipo</td>
                    <td>Acciones</td>
                </tr>
            </thead>
            <tbody>
                @foreach (SIFIET.GestionContenidos.Datos.Modelo.ATRIBUTO atributo in ViewBag.listaAtributos)
                {
                    <tr>
                        <td>@atributo.NOMBREATRIBUTO</td>
                        <td>@atributo.TIPOATRIBUTO</td>
                        <td>@Html.ActionLink("Eliminar", "EliminarAtributo", new { idCategoria = ViewBag.categoria.IDENTIFICADORCATEGORIA, idAtributo = atributo.IDENTIFICADORATRIBUTO }, new { onclick = "return confirm('¿Comfirma que desea eliminar este atributo?')" })</td>

                        </tr>
                }
            </tbody>
        </table>
    }
    else
    {
        @Html.Label("No Atributos Registrados")
    }


</div>
<div><h4>@TempData["Mensaje"]</h4></div>

<div>
    <input type="button" value="Terminar" onclick="return confirmSalirCategoria()" />
    <p> @Html.ActionLink("Volver", "Index") </p>
</div>

<script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")" type="text/javascript"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/funciones.js"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
